@import "../styles/mixins/index.less";
@import "../styles/themes/index.less";

.@{wux-prefix}-badge {
    position: relative;
    display: inline-block;
    line-height: 1;
    vertical-align: middle;

    &__count {
        position: absolute;
        transform: translateX(50%);
        top: -6px;
        right: 0;
        height: @badge-height;
        border-radius: @badge-height / 2;
        min-width: @badge-height;
        background: @badge-bg;
        // border: 1px solid transparent;
        color: @badge-color;
        line-height: @badge-height;
        text-align: center;
        padding: 0 5px;
        font-size: @badge-font-size;
        white-space: nowrap;
        transform-origin: -10% center;
        z-index: 10;
        box-shadow: 0 0 0 1px @shadow-color-inverse;
        box-sizing: border-box;
        text-rendering: optimizeLegibility;
    }

    &__dot {
        .square(@badge-dot-size);

        position: absolute;
        transform: translateX(-50%);
        transform-origin: 0 center;
        top: -4px;
        right: -8px;
        border-radius: 100%;
        background: @badge-bg;
        z-index: 10;
        box-shadow: 0 0 0 1px @shadow-color-inverse;
    }

    &__status {
        line-height: inherit;
        vertical-align: baseline;
    }

    &__status-dot {
        .square(@badge-status-size);

        display: inline-block;
        border-radius: 50%;
        vertical-align: middle;
        position: relative;
        top: -1px;

        &--success {
            background-color: @badge-success-bg;
        }

        &--processing {
            background-color: @badge-processing-bg;
            position: relative;
        }

        &--processing::after {
            position: absolute;
            top: -1px;
            left: -1px;
            width: 100%;
            height: 100%;
            border-radius: 50%;
            border: 1px solid @badge-processing-bg;
            content: "";
            animation: statusProcessing 1.2s infinite ease-in-out;
        }

        &--default {
            background-color: @badge-normal-bg;
        }

        &--error {
            background-color: @badge-error-bg;
        }

        &--warning {
            background-color: @badge-warning-bg;
        }
    }

    &__status-text {
        display: inline-block;
        color: @text-color;
        font-size: @font-size-base;
        margin-left: 8px;
    }
}

@keyframes statusProcessing {
    0% {
        transform: scale(.8);
        opacity: .5;
    }

    to {
        transform: scale(2.4);
        opacity: 0;
    }
}
